package com.datastructure.test.robbery;

import java.util.ArrayList;
import java.util.Arrays;

public class Robbery {

    public static void main(String[] args) {
        int [] nums = {1,2,3,4};
        int [] nums1 = {1,3,6};
        int [] nums2 = {2,10,5};
        Robbery robbery = new Robbery();
        System.out.println(robbery.rob(nums1));
    }

    public int rob (int[] nums) {
        // write code here
        int numsOfLength = nums.length;
        if(numsOfLength<=4) {
            int oddNumbers = 0;
            int evenNumbers = 0;
            for (int i = 0; i < nums.length; i++) {
                if (i % 2 == 0) {
                    evenNumbers += nums[i];
                } else {
                    oddNumbers += nums[i];
                }
            }
            return Math.max(oddNumbers, evenNumbers);
        } else {

        }
        return 0;
    }
}
